<template>
	<view class="">
		<view class="" v-if="list.length >0">
    
      	<view class="flex flex-column w-100">
          <block v-for="(item,index) in list" :key="index">
            <view class="flex align-center justify-between u-p-x-30 u-p-y-20 uborder-bottom w100 border-bottom" >
                <view class="flex-1 u-p-l-20">
                	<view class="flex">
                		<text>{{item.bank_name}}</text>
                	</view>
                	<view class="flex-1 u-m-t-10 text-ellipsis-2" style="width: 500rpx;">
                		<text>卡号: ********{{item.card_no}}</text>
                	</view>
                </view>
            	<u-icon @click="toEditPage(item.id)" name="edit-pen" size="40"></u-icon>
            </view>
          </block>
      	</view>
		</view>
		<view class="flex flex-column align-center u-p-y-50" v-else>
			<image src="../static/mine/no-address.png" style="width: 166rpx;" mode="widthFix"></image>
			<text class="u-m-t-30">亲，您还没绑定银行卡哦，赶快绑定吧！</text>
		</view>
		<view class="position-fixed left-0 right-0" style="bottom: 100rpx;">
			<dy-button size="default" width="576rpx" @click="toPage">绑定银行卡</dy-button>
		</view>
	</view>
</template>

<script>
	import { BaseCenterApi } from '@/api/serves.js'
	export default {
		data() {
			return {
				list: [],
				isdefault: ''
			}
		},
		onShow() {
			this.bankList()
		},
		methods: {
			bankList() {
				this.$ShowLoading()
				BaseCenterApi.bankList().then(res=> {
					this.$HideLoading()
					console.log('地址列表', res);
					if(res.code == 1) {
						this.list = res.data.list
					}
				})
			},
			toPage() {
				uni.navigateTo({
					url: '/pages/mine/settingInfo/settingBindCard/settingBindCard?type=add'
				})
			},
			toEditPage(id) {
				uni.navigateTo({
					url: '/pages/mine/settingInfo/settingBindCard/settingBindCard?type=edit&id='+id
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
page {
	background-color: #FFFFFF;
}
</style>
